/*     */ package com.qmsk.business.bussBill.bussBill.dao;
/*     */ 
/*     */ import com.qmsk.business.member.member.dao.MemberDAO;
/*     */ import com.qmsk.business.sys.basic.SupportDAO;
/*     */ import com.utils.basic.CDateTimeComm;
/*     */ import com.utils.basic.MapUtils;
/*     */ import com.utils.gson.in.GsonHeadOneRow;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.gson.out.GsonEbRstData;
/*     */ import java.sql.SQLException;
/*     */ import java.util.Date;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ import org.apache.commons.lang.StringUtils;
/*     */ 
/*     */ public class BussBillDao extends SupportDAO
/*     */ {
/*     */   public GsonEbRst getGsonOfShopId(String shopId, Integer nPageIdx, Short nPageSize)
/*     */     throws SQLException
/*     */   {
/*  22 */     Map params = new HashMap();
/*  23 */     params.put("shopId", shopId);
/*  24 */     GsonEbRst g = getGsonOfParams("selectSqlOfShopId", 
/*  25 */       "selectCountSqlOfShopId", "selectJsonOfAll", params, nPageIdx, 
/*  26 */       nPageSize);
/*  27 */     setManyRowIncomeName(g);
/*  28 */     return g;
/*     */   }
/*     */ 
/*     */   public GsonEbRst getGsonOfShopIdStId(Map<String, Object> params, Integer nPageIdx, Short nPageSize) throws SQLException
/*     */   {
/*  33 */     GsonEbRst g = getGsonOfParams("selectSqlOfShopId", 
/*  34 */       "selectCountSqlOfShopId", "selectJsonOfAll", params, nPageIdx, 
/*  35 */       nPageSize);
/*  36 */     setManyRowIncomeName(g);
/*  37 */     return g;
/*     */   }
/*     */ 
/*     */   public int updateCheckedOfIds(Long userId, String userName, Object id) throws SQLException
/*     */   {
/*  42 */     Object[] strParams = { userId, userName, id };
/*  43 */     return update("updateCheckedOfIds", strParams);
/*     */   }
/*     */ 
/*     */   public GsonHeadOneRow getBillIntegralOfId(Object id, Object memberId, Integer stId) throws SQLException
/*     */   {
/*  48 */     Map param = new HashMap();
/*  49 */     param.put("memberId", memberId);
/*  50 */     param.put("id", id);
/*  51 */     if (stId.intValue() == 1) {
/*  52 */       int[] status = { 1, 
/*  53 */         2, 3, 
/*  54 */         4, 5, 
/*  55 */         6 };
/*  56 */       param.put("status", status);
/*     */     } else {
/*  58 */       param.put("status", Integer.valueOf(2));
/*     */     }
/*  60 */     MemberDAO memberdao = new MemberDAO();
/*  61 */     Integer levelId = memberdao.getLevelIdNormal(memberId, stId);
/*  62 */     if ((levelId != null) && (levelId.intValue() > 0)) {
/*  63 */       Object[] params = { id, levelId, memberId };
/*  64 */       GsonHeadOneRow g = getOneRowOfParams("selectsqlBillIntegralOfIdLV", 
/*  65 */         "selectjsonBillCashCouPonOfIntegeral", params);
/*  66 */       if ((g == null) || ((g != null) && (!(g.isExistsData())))) {
/*  67 */         g = getOneRowOfParams("selectsqlBillIntegralOfId", 
/*  68 */           "selectjsonBillCashCouPonOfIntegeral", param);
/*     */       }
/*  70 */       return g;
/*     */     }
/*  72 */     return getOneRowOfParams("selectsqlBillIntegralOfId", 
/*  73 */       "selectjsonBillCashCouPonOfIntegeral", param);
/*     */   }
/*     */ 
/*     */   public GsonHeadOneRow getBillCashCouPonOfId(Object id, Object memberId, Integer stId)
/*     */     throws SQLException
/*     */   {
/*  79 */     Map param = new HashMap();
/*  80 */     param.put("memberId", memberId);
/*  81 */     param.put("id", id);
/*  82 */     if (stId.intValue() == 1) {
/*  83 */       int[] status = { 1, 
/*  84 */         2, 3, 
/*  85 */         4, 5, 
/*  86 */         6 };
/*  87 */       param.put("status", status);
/*     */     } else {
/*  89 */       param.put("status", Integer.valueOf(2));
/*     */     }
/*  91 */     MemberDAO memberdao = new MemberDAO();
/*  92 */     Integer levelId = memberdao.getLevelIdNormal(memberId, stId);
/*  93 */     if ((levelId != null) && (levelId.intValue() > 0)) {
/*  94 */       Object[] params = { id, levelId, memberId };
/*  95 */       GsonHeadOneRow g = getOneRowOfParams(
/*  96 */         "selectsqlBillCashCouPonOfIdLV", 
/*  97 */         "selectjsonBillCashCouPonOfIntegeral", params);
/*  98 */       if ((g == null) || ((g != null) && (!(g.isExistsData())))) {
/*  99 */         g = getOneRowOfParams("selectsqlBillCashCouPonOfId", 
/* 100 */           "selectjsonBillCashCouPonOfIntegeral", param);
/*     */       }
/* 102 */       return g;
/*     */     }
/* 104 */     return getOneRowOfParams("selectsqlBillCashCouPonOfId", 
/* 105 */       "selectjsonBillCashCouPonOfIntegeral", param);
/*     */   }
/*     */ 
/*     */   public int updateBillPaidOfIds(String id, Object userId, Object userName)
/*     */     throws SQLException
/*     */   {
/* 111 */     Object[] strParams = { userId, userName, id };
/* 112 */     return update("updateBillPaidOfIds", strParams);
/*     */   }
/*     */ 
/*     */   public GsonEbRst getGsonOfBussId(Integer bussId) throws SQLException {
/* 116 */     Map params = new HashMap();
/* 117 */     params.put("bussId", bussId);
/* 118 */     GsonEbRst g = getGsonOfParams("selectSqlOfShopId", "selectJsonOfAll", 
/* 119 */       params);
/* 120 */     setManyRowIncomeName(g);
/* 121 */     return g;
/*     */   }
/*     */ 
/*     */   public GsonHeadOneRow getGsonHeadOneRowOfBsbillIds(Object bissId) throws SQLException
/*     */   {
/* 126 */     Object[] params = { bissId };
/* 127 */     return getOneRowOfParams("selectPaidSqlOfBsbillIds", 
/* 128 */       "selectPaidJsonOfBsbillIds", params, Integer.valueOf(0), Short.valueOf((short) 1));
/*     */   }
/*     */ 
/*     */   public GsonEbRst getGsonOfShopId_StId_Sum_Date(Map<String, Object> params)
/*     */     throws SQLException
/*     */   {
/* 139 */     return getGsonOfParams("selectSqlOfSumShopId", "selectJsonSumOfAll", 
/* 140 */       params);
/*     */   }
/*     */ 
/*     */   public GsonEbRst getGsonOfShopId_StId_Paid_Date(Map<String, Object> params, Integer nPageIdx, Short nPageSize) throws SQLException
/*     */   {
/* 145 */     GsonEbRst g = getGsonOfParams("selectSqlOfShopId", 
/* 146 */       "selectCountSqlOfShopId", "selectJsonOfAll", params, nPageIdx, 
/* 147 */       nPageSize);
/* 148 */     setManyRowIncomeName(g);
/* 149 */     return g;
/*     */   }
/*     */ 
/*     */   public GsonEbRst getGsonOfShopId_StId_Paid_Date(Object shopId, Object stId, Object paid, Long classesNoStart, Long classesNoEnd, Integer nPageIdx, Short nPageSize)
/*     */     throws SQLException
/*     */   {
/* 155 */     Map params = new HashMap();
/* 156 */     MapUtils.addToMap(params, "shopId", shopId);
/* 157 */     MapUtils.addToMap(params, "stId", stId);
/* 158 */     MapUtils.addToMap(params, "paid", paid);
/* 159 */     MapUtils.addToMap(params, "classesNoStart", classesNoStart);
/* 160 */     MapUtils.addToMap(params, "classesNoEnd", classesNoEnd);
/* 161 */     GsonEbRst g = getGsonOfParams("selectSqlOfShopId", 
/* 162 */       "selectCountSqlOfShopId", "selectJsonOfAll", params, nPageIdx, 
/* 163 */       nPageSize);
/* 164 */     setManyRowIncomeName(g);
/* 165 */     return g;
/*     */   }
/*     */ 
/*     */   public int updateBillIdOfAmt(Object bissId, Integer intAmt) throws SQLException
/*     */   {
/* 170 */     Map params = new HashMap();
/* 171 */     params.put("bissId", bissId);
/* 172 */     params.put("intAmt", intAmt);
/* 173 */     return update("updateBillIdOfAmt", params);
/*     */   }
/*     */ 
/*     */   public int updateBillIdOfCashAmt(Object bissId, Double cashConp) throws SQLException
/*     */   {
/* 178 */     Map params = new HashMap();
/* 179 */     params.put("bissId", bissId);
/* 180 */     params.put("cashConp", cashConp);
/* 181 */     return update("updateBillIdOfCashAmt", params);
/*     */   }
/*     */ 
/*     */   private void setManyRowIncomeName(GsonEbRst g) {
/* 185 */     if ((g != null) && (g.getResult().getDataLength() > 0)) {
/* 186 */       int msHeadPos = g.getResult().getPosOfName("msName");
/* 187 */       int incomePos = g.getResult().getPosOfName("IncomeName");
/* 188 */       for (int i = 0; i < g.getResult().getDataLength(); ++i) {
/* 189 */         Object o1 = g.getResult().getValueOfIdx(i, msHeadPos);
/* 190 */         if ((o1 != null) && (!(StringUtils.isEmpty((String)o1))))
/* 191 */           g.getResult().setValueOfIdx(i, incomePos, o1);
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   public GsonHeadOneRow getBillOfId(Object bissId) throws SQLException
/*     */   {
/* 198 */     Object[] params = { bissId };
/* 199 */     return getOneRowOfParams("selectSqlBillOfIdNtive", 
/* 200 */       "selectJsonBillOfIdNtive", params);
/*     */   }
/*     */ 
/*     */   public int inserBussbillOfSalebill(Map<String, Object> params) throws SQLException
/*     */   {
/* 205 */     return update("insertBussbillOfSaleBill", params);
/*     */   }
/*     */ 
/*     */   public int deleteBussBillOfBillNo(String billNo) throws SQLException {
/* 209 */     Object[] params = { billNo };
/* 210 */     return update("deleteBussBillOfBillNo", params);
/*     */   }
/*     */ 
/*     */   public String getMaxBillNo(Object shopId) throws SQLException {
/* 214 */     return getSpTableFieldDayNoShopId("BillNo", shopId);
/*     */   }
/*     */ 
/*     */   public GsonEbRst getGsonOfWxOfBussInfo(String openId, Long shopId, Integer nPageIdx, Short nPageSize) throws SQLException
/*     */   {
/* 219 */     Object[] params = { openId, shopId };
/* 220 */     if (nPageIdx.intValue() > 0) {
/* 221 */       nPageIdx = Integer.valueOf(nPageIdx.intValue() - 1);
/*     */     }
/* 223 */     GsonEbRst g = getGsonOfParams("selectSqlWxOfBussInfo", params, nPageIdx, 
/* 224 */       nPageSize, true);
/* 225 */     if ((g != null) && (g.isExistsData())) {
/* 226 */       int i = 0; 
/*     */       while (true) { Date data = (Date)g.getResult().getValueOfIdx(i, "ReceDate");
/* 228 */         if (data != null) {
/* 229 */           String ndata = CDateTimeComm.dateToyyyymmdd(data);
/* 230 */           g.getResult().setValueOfIdx(i, "ReceDate", ndata);
/*     */         }
/* 226 */         ++i; if (i >= g.getDataLength())
/*     */         {
/* 233 */           label113: return g; } }
/*     */     }
/* 235 */     return g;
/*     */   }
/*     */ 
/*     */   public GsonEbRst getGsonOfAll(Long memberId, Integer nPageIdx, Short nPageSize) throws SQLException
/*     */   {
/* 240 */     Map params = new HashMap();
/* 241 */     params.put("memberId", memberId);
/* 242 */     return getGsonOfParams("selectSqlWxMemberPayHistory", params, nPageIdx, nPageSize, true);
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.bussBill.bussBill.dao.BussBillDao
 * JD-Core Version:    0.5.3
 */